package fpzhan.plane.program.proxy;

import com.alibaba.fastjson.JSONObject;
import fpzhan.plane.program.compose.ComposeContent;
import fpzhan.plane.program.compose.ComposeContext;

import java.util.Set;

public abstract class CodeBlockProxy implements Comparable<CodeBlockProxy>{

      private String name;

      private Integer index=0;

      public CodeBlockProxy(String proxyName,Integer index) {
            this.index = index;
            this.name=proxyName;
      }

      public abstract JSONObject before(ComposeContext composeContext, ComposeContent composeContent, Set<String> keys ,  JSONObject json)throws Exception;

      public  abstract void after(JSONObject before , ComposeContext composeContext,  ComposeContent composeContent, Set<String> keys ,  JSONObject json)throws Exception;

      @Override
      public int compareTo(CodeBlockProxy o) {
            return this.index.compareTo(o.index);
      }

      public String getName() {
            return name;
      }
}
